NestJS supports four versioning strategies via app.enableVersioning(): URI versioning (/v1/users), Header versioning (X-API-Version: 1), Media Type versioning (Accept: application/json;v=1), and Custom versioning with a user-defined extractor function. All are enabled before app.listen() in main.ts.
URI versioning — most visible and cacheable; breaks REST purity but simplest for clients.
Header versioning — clean URLs; requires clients to set a custom header on every request.
Media type versioning — fully REST-compliant but complex for clients and tooling.
Custom versioning — maximum flexibility; use when version comes from a non-standard location.
Call app.enableVersioning() before app.listen() and after app.useGlobalPipes/Guards/etc.